package Commands;

import domain.Controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class CmdUserStory5 extends Command
{
  Controller controller;
  protected String nextJspUrl = "userStory5.jsp"; 

  public void init(CommandFactory comFac, Controller c)
    throws ServletException 
  {
    this.controller = c;
  }

  public void execute(HttpServletRequest request, HttpServletResponse resp)
    throws ServletException 
  {    
    HttpSession session = request.getSession(true);
    controller.clearPuljer();
    session.removeAttribute("pulje1");
    session.removeAttribute("pulje2");
    controller.getPuljer();
    session.setAttribute("pulje1",controller.getPulje1());
    session.setAttribute("pulje2",controller.getPulje2());
    session.setAttribute("subjects",controller.getAllSubjects());
  }
  
  public String getNextJspUrl()
  {
    return nextJspUrl;
  }
}

